﻿using System;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.TextManager.Interop;

namespace Red.Scripts.Legacy
{
    /// <summary>
    /// This is a visual studio "Legacy" language service
    /// </summary>
    /// <remarks>
    /// This is currently required to support:
    ///  - Adding the default "language" options (such as line numbers, indenting, scrollbar map view etc)
    /// </remarks>
    [Guid( Defines.Guids.Language.Id.Raw )]
    internal partial class LanguageInfo : IVsLanguageInfo
    {
        /// <summary>
        /// Fairly certain this needs to match the "Content type" of the non-legacy service
        /// </summary>
        public const string LanguageName = "redscript";

        public int GetCodeWindowManager( IVsCodeWindow pCodeWin, out IVsCodeWindowManager ppCodeWinMgr )
        {
            ppCodeWinMgr = null;
            return VSConstants.E_NOTIMPL;
        }

        public int GetColorizer( IVsTextLines pBuffer, out IVsColorizer ppColorizer )
        {
            ppColorizer = null;
            return VSConstants.E_NOTIMPL;
        }

        public int GetFileExtensions( out string pbstrExtensions )
        {
            pbstrExtensions = ".script";
            return VSConstants.S_OK;
        }

        public int GetLanguageName( out string bstrName )
        {
            bstrName = LanguageName;
            return VSConstants.S_OK;
        }
    }
}
